74A - Room Leader - CodeForces Solution


implementation *1000

Please click on ads to support us..

Python Code:

import math
result=["x",-math.inf]
for x in range(int(input())):
    l=[int(x) if x.isnumeric() else x for x in input().split()]
    target=(sum(l[3:])+100*l[1]-50*l[2])
    if result[1]<target:
        result=[l[0],target]
        
print(result[0])

C++ Code:

#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef vector<ll> v64;
typedef vector<int> v32;
typedef pair<ll, ll> pll;
const ll MOD = 1e9 + 7;

#define maxi(a,b,c) max(a,max(b,c));
#define mini(a,b,c) min(a,min(b,c));
#define fl0(i,n) for(ll i=0;i<n;i++)
#define fl1(i,n) for(ll i=1;i<=n;i++)
#define fast ios_base::sync_with_stdio(NULL),cin.tie(NULL),cout.tie(NULL);



int main()
{
	fast
	
	ll m=INT_MIN;
	string ans;
	
	ll n;cin>>n;
	while(n--)
	{
	      string handle;
	      ll plus,minus,a,b,c,d,e;
	      
	      cin>>handle;
	      cin>>plus>>minus>>a>>b>>c>>d>>e;
	      
	      ll fscore=a+b+c+d+e+100*(plus)-50*(minus);
	      
	      if(fscore>m)
	      {
	            m=fscore;
	            ans=handle;
	            
	      }
	      
	}
	
	cout<<ans<<"\n";



	return 0;
}


Comments

Submit
0 Comments
More Questions

Number of triangles
AND path in a binary tree
Factorial equations
Removal of vertices
Happy segments
Cyclic shifts
Zoos
Build a graph
Almost correct bracket sequence
Count of integers
Differences of the permutations
Doctor's Secret
Back to School
I am Easy
Teddy and Tweety
Partitioning binary strings
Special sets
Smallest chosen word
Going to office
Color the boxes
Missing numbers
Maximum sum
13 Reasons Why
Friend's Relationship
Health of a person
Divisibility
A. Movement
Numbers in a matrix
Sequences
Split houses